package com.xbenben.project.scheduled;

import com.xbenben.project.wxpush.service.SendService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author yu.zhijia
 * Date:2023/6/2 11:44
 **/
@Component
@Slf4j
public class WxScheduled {

    @Autowired
    private SendService sendService;

    /**
     * 每天早上7：30执行推送
     */
    @Scheduled(cron = "0 30 7 ? * *")
    public void send() {
        try {
            sendService.sendWeChatMsg();
        } catch (Exception e) {
            e.printStackTrace();
            log.error("信息推送失败");
        }
    }



}
